/**
 */
package usixmlcui.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import usixmlcui.ConcreteGraphicalRelationship;
import usixmlcui.GridLayout;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Grid Layout</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.GridLayoutImpl#getNumberRows <em>Number Rows</em>}</li>
 *   <li>{@link usixmlcui.impl.GridLayoutImpl#getNumberColumns <em>Number Columns</em>}</li>
 *   <li>{@link usixmlcui.impl.GridLayoutImpl#getCellWidth <em>Cell Width</em>}</li>
 *   <li>{@link usixmlcui.impl.GridLayoutImpl#getCellHeight <em>Cell Height</em>}</li>
 *   <li>{@link usixmlcui.impl.GridLayoutImpl#getEReference0 <em>EReference0</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GridLayoutImpl extends EObjectImpl implements GridLayout {
	/**
	 * The default value of the '{@link #getNumberRows() <em>Number Rows</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberRows()
	 * @generated
	 * @ordered
	 */
	protected static final int NUMBER_ROWS_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNumberRows() <em>Number Rows</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberRows()
	 * @generated
	 * @ordered
	 */
	protected int numberRows = NUMBER_ROWS_EDEFAULT;

	/**
	 * The default value of the '{@link #getNumberColumns() <em>Number Columns</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberColumns()
	 * @generated
	 * @ordered
	 */
	protected static final int NUMBER_COLUMNS_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNumberColumns() <em>Number Columns</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberColumns()
	 * @generated
	 * @ordered
	 */
	protected int numberColumns = NUMBER_COLUMNS_EDEFAULT;

	/**
	 * The default value of the '{@link #getCellWidth() <em>Cell Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCellWidth()
	 * @generated
	 * @ordered
	 */
	protected static final float CELL_WIDTH_EDEFAULT = 0.0F;

	/**
	 * The cached value of the '{@link #getCellWidth() <em>Cell Width</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCellWidth()
	 * @generated
	 * @ordered
	 */
	protected float cellWidth = CELL_WIDTH_EDEFAULT;

	/**
	 * The default value of the '{@link #getCellHeight() <em>Cell Height</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCellHeight()
	 * @generated
	 * @ordered
	 */
	protected static final float CELL_HEIGHT_EDEFAULT = 0.0F;

	/**
	 * The cached value of the '{@link #getCellHeight() <em>Cell Height</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCellHeight()
	 * @generated
	 * @ordered
	 */
	protected float cellHeight = CELL_HEIGHT_EDEFAULT;

	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalRelationship eReference0;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GridLayoutImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.GRID_LAYOUT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNumberRows() {
		return numberRows;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberRows(int newNumberRows) {
		int oldNumberRows = numberRows;
		numberRows = newNumberRows;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.GRID_LAYOUT__NUMBER_ROWS, oldNumberRows, numberRows));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNumberColumns() {
		return numberColumns;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberColumns(int newNumberColumns) {
		int oldNumberColumns = numberColumns;
		numberColumns = newNumberColumns;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.GRID_LAYOUT__NUMBER_COLUMNS, oldNumberColumns, numberColumns));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public float getCellWidth() {
		return cellWidth;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCellWidth(float newCellWidth) {
		float oldCellWidth = cellWidth;
		cellWidth = newCellWidth;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.GRID_LAYOUT__CELL_WIDTH, oldCellWidth, cellWidth));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public float getCellHeight() {
		return cellHeight;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCellHeight(float newCellHeight) {
		float oldCellHeight = cellHeight;
		cellHeight = newCellHeight;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.GRID_LAYOUT__CELL_HEIGHT, oldCellHeight, cellHeight));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalRelationship getEReference0() {
		if (eReference0 != null && eReference0.eIsProxy()) {
			InternalEObject oldEReference0 = (InternalEObject)eReference0;
			eReference0 = (ConcreteGraphicalRelationship)eResolveProxy(oldEReference0);
			if (eReference0 != oldEReference0) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.GRID_LAYOUT__EREFERENCE0, oldEReference0, eReference0));
			}
		}
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalRelationship basicGetEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(ConcreteGraphicalRelationship newEReference0) {
		ConcreteGraphicalRelationship oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.GRID_LAYOUT__EREFERENCE0, oldEReference0, eReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_ROWS:
				return new Integer(getNumberRows());
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_COLUMNS:
				return new Integer(getNumberColumns());
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_WIDTH:
				return new Float(getCellWidth());
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_HEIGHT:
				return new Float(getCellHeight());
			case Usixml_cuiPackage.GRID_LAYOUT__EREFERENCE0:
				if (resolve) return getEReference0();
				return basicGetEReference0();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_ROWS:
				setNumberRows(((Integer)newValue).intValue());
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_COLUMNS:
				setNumberColumns(((Integer)newValue).intValue());
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_WIDTH:
				setCellWidth(((Float)newValue).floatValue());
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_HEIGHT:
				setCellHeight(((Float)newValue).floatValue());
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__EREFERENCE0:
				setEReference0((ConcreteGraphicalRelationship)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_ROWS:
				setNumberRows(NUMBER_ROWS_EDEFAULT);
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_COLUMNS:
				setNumberColumns(NUMBER_COLUMNS_EDEFAULT);
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_WIDTH:
				setCellWidth(CELL_WIDTH_EDEFAULT);
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_HEIGHT:
				setCellHeight(CELL_HEIGHT_EDEFAULT);
				return;
			case Usixml_cuiPackage.GRID_LAYOUT__EREFERENCE0:
				setEReference0((ConcreteGraphicalRelationship)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_ROWS:
				return numberRows != NUMBER_ROWS_EDEFAULT;
			case Usixml_cuiPackage.GRID_LAYOUT__NUMBER_COLUMNS:
				return numberColumns != NUMBER_COLUMNS_EDEFAULT;
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_WIDTH:
				return cellWidth != CELL_WIDTH_EDEFAULT;
			case Usixml_cuiPackage.GRID_LAYOUT__CELL_HEIGHT:
				return cellHeight != CELL_HEIGHT_EDEFAULT;
			case Usixml_cuiPackage.GRID_LAYOUT__EREFERENCE0:
				return eReference0 != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (numberRows: ");
		result.append(numberRows);
		result.append(", numberColumns: ");
		result.append(numberColumns);
		result.append(", cellWidth: ");
		result.append(cellWidth);
		result.append(", cellHeight: ");
		result.append(cellHeight);
		result.append(')');
		return result.toString();
	}

} //GridLayoutImpl
